<?php
namespace app\api\controller;
use app\api\model\Setting as SettingModel;

/**
 * 商户配置
 */
class Setting extends Controller
{
    /**
     * 订阅消息配置
	 * $tang_mode 1=包间点餐 2=排号点餐
	 * $food_mode 2=预约自取 3=外卖 其它堂食
     */
    public function tpl($food_mode,$tang_mode)
    {
		$values = SettingModel::getItem('tpl');
		$tpl = [];
		if($food_mode==2){
			if(!empty($values['take'])){
				array_push($tpl,$values['take']);
			}	
		}elseif($food_mode==3){
			if(!empty($values['remind'])){
				array_push($tpl,$values['remind']);
			}
			if(!empty($values['delivery'])){
				array_push($tpl,$values['delivery']);
			}
		}else{
			if($tang_mode==1){
				//包间点餐
				if(!empty($values['remind'])){
					array_push($tpl,$values['remind']);
				}
			}else{
				//排号点餐
				if(!empty($values['take'])){
					array_push($tpl,$values['take']);
				}
			}
		}
		if(!empty($values['finish'])){
			array_push($tpl,$values['finish']);
		}
		return $this->renderSuccess(compact('tpl'));
    }

}
